/*
 * // +-------------------------------------------------------------------------------------------------
 * // |                 有你就好 [ 有节骨乃坚，无心品自端 ]     <http://encoding.wang>
 * // +-------------------------------------------------------------------------------------------------
 * // |                             独在异乡为异客         每逢佳节倍思亲
 * // +-------------------------------------------------------------------------------------------------
 * // |                 联系:   <707069100@qq.com>      <http://weibo.com/513778937>
 * // +-------------------------------------------------------------------------------------------------
 */

// -----------------------------------------------------------------------------------------------------
// +----------------------------------------------------------------------------------------------------
// |                   ErYang出品 属于小极品          共同学习    共同进步
// +----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------


package wang.encoding.mroot.plugin.ueditor.upload;

import wang.encoding.mroot.plugin.ueditor.define.State;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;


/**
 * 上传
 *
 * @author ErYang
 */
public class Uploader {

    private HttpServletRequest request;
    private Map<String, Object> conf;

    /**
     * 上传
     *
     * @param request HttpServletRequest
     * @param conf    Map<String, Object>
     */
    public Uploader(final HttpServletRequest request, final Map<String, Object> conf) {
        this.request = request;
        this.conf = conf;
    }

    // -------------------------------------------------------------------------------------------------

    /**
     * 处理
     *
     * @return State
     */
    public final State doExec() {
        State state;
        String trueStr = "true";
        String isBase64 = "isBase64";
        if (trueStr.equals(this.conf.get(isBase64))) {
            state = new Base64Uploader().save(this.request,
                    this.conf);
        } else {
            state = new BinaryUploader().save(this.request, this.conf);
        }
        return state;
    }

    // -------------------------------------------------------------------------------------------------

}

// -----------------------------------------------------------------------------------------------------

// End Uploader class

/* End of file Uploader.kt */
/* Location: ./src/main/kotlin/wang/encoding/mroot/plugin/ueditor/upload/Uploader.kt */

// -----------------------------------------------------------------------------------------------------
// +----------------------------------------------------------------------------------------------------
// |                           ErYang出品 属于小极品  O(∩_∩)O~~   共同学习    共同进步
// +----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
